package homework.apiday06.exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        try {
//            String str = null;
//            System.out.println(str.length());
//            String str = "abc";
//            System.out.println(Integer.parseInt(str));
            String str = "abc";
            System.out.println(str.charAt(5));

        }catch (NullPointerException e){
            System.out.println("出现了空指针异常");
        }catch (StringIndexOutOfBoundsException e){
            System.out.println("数组下标越界异常");
        }catch (Exception e){
            System.out.println("反正出错了");
        }
        System.out.println("程序结束了");







    }
}
